package com.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class AdminReal implements IAdminDao {
	private PreparedStatement ptmt;
	private Connection conn;

	public AdminReal(Connection conn) {
		this.conn = conn;
	}

	public String checkLogin(String aUserName, String aUserPassword) throws Exception {
		String aName = null;
		String sql = "select aName from admin where aUserName=? and aUserPassword=?";
		this.ptmt = conn.prepareStatement(sql);
		this.ptmt.setString(1, aUserName);
		this.ptmt.setString(2, aUserPassword);
		ResultSet rs = this.ptmt.executeQuery();
		while (rs.next()) {
			aName = rs.getString(1);
		}
		return aName;
	}
}
